<?php

/**
 * Menashop
 *
 * LICENSE
 *
 * This source file is subject to the license that is bundled
 * with this project in the file LICENSE.txt
 *
 * @category   Zend
 * @package    Admin_Model
 * @subpackage FormOrder
 * @copyright  Copyright (c) 2011 Menashop UA Inc. (http://www.menashop.com.ua)
 * @license    LICENSE.txt
 * @version    1.0.0
 * @since      File available since Release 1.0.0
 */

/**
 * The form for order
 * 
 * @category   Zend
 * @package    Admin_Model
 * @subpackage FromOrder
 * @copyright  Copyright (c) 2011 Menashop UA Inc. (http://www.menashop.com.ua)
 * @license    LICENSE.txt
 */
class Admin_Model_FormOrder extends Zend_Form
{

    public function init()
    {
        $this->setMethod('post');

        $total = new Zend_Form_Element_Text('total');
        $total->setRequired(true);
        $total->addErrorMessage('Please provide total');
        $total->addValidator(new Zend_Validate_Float(array('locale' => 'en_us')));
        $total->removeDecorator('label');
        $total->removeDecorator('htmlTag');
        $total->removeDecorator('Errors');
        $this->addElement($total);

        $status = new Zend_Form_Element_Select('status');
        $orderStatusModel = new Admin_Model_OrderStatus();
        $orderStatuses = $orderStatusModel->fetchAllPairs();
        foreach ($orderStatuses as $key => $value) {
            $status->addMultiOption($key, $value);
        }
        $status->setRequired(true);
        $status->addErrorMessage('Please provide status');
        $status->removeDecorator('label');
        $status->removeDecorator('htmlTag');
        $status->removeDecorator('Errors');
        $this->addElement($status);

        $submit = new Zend_Form_Element_Submit('submit');
        $submit->setLabel('Save');
        $submit->removeDecorator('DtDdWrapper');
        $this->addElement($submit);

        $this->setDecorators(array(array('ViewScript', array('viewScript' => '_form_order.phtml'))));
    }

}

